<template>
  <div class="base-table-box">
    <div class="table-select-group">
      <div class="clearfix">
        <div class="left">
          <s-select
            placeholder="-全部-"
            style="width: 120px"
            allowClear
            :selectOption="year"
            v-model="params.strYear"
          />
          <a-input
            class="search-input"
            v-model="params.search"
            placeholder="请输入搜索内容"
          />
          <s-select
            :selectOption="proposal.userState"
            v-model="params.userState"
            placeholder="-用户类型-"
            style="width: 170px"
            allowClear
          />
          <a-button style="margin-left: 16px" type="primary" @click="start"
            >查询</a-button
          >
          <a-button @click="reset" class="btn-reset">重置</a-button>
        </div>

        <div class="right">
          <a-button type="primary" @click="add">发送短信</a-button>
          <a-button @click="$router.back()">返回</a-button>
        </div>
      </div>
      <div class="tabs">
        <span>全部</span>
        <span>已读1件</span>
        <span class="active">未读27件</span>
      </div>
    </div>

    <a-table
      :row-selection="{
        selectedRowKeys: selectedRowKeys,
        onChange: onSelectChange
      }"
      :pagination="pagination"
      :columns="columns"
      :data-source="tableData"
      :loading="loading"
      :scroll="{ y: '100%' }"
    >
    </a-table>
  </div>
</template>
<script>
import paging from 'mixins/paging'
import deleteItem from 'mixins/delete-table-item.js'
import { proposal } from 'assets/js/select-option-list'
const columns = [
  {
    title: '通知标题',
    dataIndex: 'name'
  },
  {
    title: '发布单位',
    dataIndex: 'age'
  },
  {
    title: '发布时间',
    dataIndex: 'address',
    sorter: (a, b) => a.name.length - b.name.length
  },
  {
    title: '发布状态',
    dataIndex: 'address2',
    sorter: (a, b) => a.name.length - b.name.length
  },
  {
    title: '操作',
    dataIndex: 'address3'
  }
]

export default {
  data() {
    return {
      columns,
      proposal,
      params: {
        strYear: '1',
        userState: undefined,
        search: ''
      },
      year: [
        { key: '0', label: '用户名' },
        { key: '1', label: '姓名' },
        { key: '2', label: '手机号' }
      ]
    }
  },
  mixins: [paging, deleteItem],
  components: {},
  methods: {
    start() {
      console.log(this.form)
      // this.loading = true
      // // ajax request after empty completing
      // setTimeout(() => {
      //   this.loading = false
      //   this.selectedRowKeys = []
      // }, 1000)
    },
    add() {
      this.$router.push('/console/proposal/collect/noticelist/addnotice')
    },
    deleteList(ids) {
      this.deleteItemMixins(() => {}, ids)
    },
    getTableData() {
      for (let i = 0; i < this.pagination.pageSize; i++) {
        this.tableData.push({
          key: i,
          name: `Edward King ${i}`,
          age: 32,
          address: `London, Park Lane no. ${i}`
        })
      }
      this.pagination.total = 200
    }
  }
}
</script>
<style lang="less" scoped>
.tabs {
  height: 49px;
  line-height: 40px;
  margin-top: 20px;
  span {
    font-size: 14px;
    padding: 10px 15px;
    color: #666666;
    cursor: pointer;
    border-radius: 2px;
    margin-right: 25px;
  }
  .active {
    background: #e6f2f9;
    color: #097bc7;
  }
}
</style>